﻿using System;
using System.Collections.Generic;
using System.Web;
using Huayou.Common;
using System.Configuration;

namespace PayRoller.Code
{
    public class ParentPage : CommonBasePage
    {
        public string m_ModuleCode = "";
        public string m_PermList = "";
        public string m_UserName = "";
        public string m_UserRule = "";
        public string m_UserSid = "";

        protected void CheckLogin(bool IsJump)
        {
            if ((HttpContext.Current.Request.Cookies["UserSid"] != null) && (HttpContext.Current.Request.Cookies["UserSid"].Value != ""))
            {
                this.m_UserSid = HttpContext.Current.Request.Cookies["UserSid"].Value;
                this.m_UserName = HttpContext.Current.Request.Cookies["UserNameA"].Value;
                this.m_UserRule = HttpContext.Current.Request.Cookies["UserRule"].Value;
                this.m_PermList = HttpContext.Current.Request.Cookies["UserPerm"].Value;
            }
            else
            {
                this.m_UserSid = this.m_UserName = "";
                if (IsJump)
                {
                    HttpContext.Current.Response.Redirect("~/"+ ConfigurationManager.AppSettings["ErrorPath"]);
                }
            }
        }

        protected void CheckPerm()
        {
            if ((this.m_ModuleCode != "") && (this.m_PermList.IndexOf("," + this.m_ModuleCode + ",") == -1))
            {
                HttpContext.Current.Response.Redirect("~/Manage/NotPopedom.aspx");
            }
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }
    }
}
